(function() {
	var page = pf.newPage('home_small');
	page.IS_SHOW_BOARD = true;
	var $el = null;
	var porsche_drives_small = null;

	var _a_car = '';
	var _param = '';

	/**
	 * 初始化时调用
	 */
	page.onCreate = function() {
		$el = page.$el;
		porsche_drives_small = new Drives_jump();
		$el.on('click', '.in_cars', function() {
			var car_id = $(this).find(".in_car_many").attr("car_id");
			pf.goPage('detail', {detailID: car_id});
			// pf.goPage('model', {
			// 	cars: _param,
			// 	car: car_id
			// });
		});
	};

	/**
	 * 页面显示时自动调用
	 */
	page.onShow = function(params) {
		pf.setMid(2, 0, 0);
		$el.find("#CARS_small").find(".in_cars_box").empty();
		$el.find('.home_text').html(__(params));
		// $el.show();
		porsche_drives_small._init(params);

		// home页面特效
	};

	/**
	 * 页面隐藏时调用
	 */
	page.onHide = function() {
		// $el.hide();
	};

	/**
	 * 页面中下部点击事件
	 */
	page.onMidEvent = function(flag) {
		// flag = prev || back || next
		if (flag == 'back')
			pf.goPage('home');
		if (flag == 'prev')
			pf.goPage('home');
	};



	var Drives_jump = function() {
		// this=id

	}
	Drives_jump.prototype._init = function(param) {
		// =======
		// 页面跳转
		// $('.in_cars_box').css('width', config.cars[param].length * 472);
		for (var i in config.cars[param]) {
			if (param == "lifestyle") {
				var liao = '<li class="e_car  porsche_image home_list in_cars" style="background-image:url(./image/' + param + '/' + config.cars[param][i] + '.png)"><div class="img_home_logo porsche_image"></div><div car_id=' + config.cars[param][i] + ' class="in_car_many">' + __('' + param + "_" + ((i - 0) + 1) + '') + '</div></li>'
			} else {
				liao = '<li class="e_car  porsche_image home_list in_cars" style="background-image:url(./image/' + param + '/' + config.cars[param][i] + '.jpg)"><div class="img_home_logo porsche_image"></div><div car_id=' + config.cars[param][i] + ' class="in_car_many">' + __('' + param + "_" + ((i - 0) + 1) + '') + '</div></li>'
			}
			$el.find("#CARS_small").find(".in_cars_box").append(liao);
		};

		_param = param;

	}
})();